package cn.jobstart.controller;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeTrainingExperienceDTO;
import cn.jobstart.dto.ResumeTrainingExperiencePageDTO;
import cn.jobstart.modelExt.ResumeTrainingExperienceExt;
import cn.jobstart.searchExt.ResumeTrainingExperienceSearchExt;
import cn.jobstart.service.IResumeTrainingExperienceService;
import cn.jobstart.vo.ResumeTrainingExperienceDetailVO;
import cn.jobstart.vo.ResumeTrainingExperienceListVO;
import cn.jobstart.vo.ResumeTrainingExperienceDomainVO;
import cn.jobstart.vo.ResumeTrainingExperienceDetailDomainVO;
import cn.jobstart.export.ResumeTrainingExperienceDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeTrainingExperienceController      培训经历
*/
@Api(tags = "人才管理系统-培训经历相关", description = "培训经历相关接口")
@RestController(value ="resumeTrainingExperienceRestfulController")
@RequestMapping("/resumeTrainingExperience/")
@Validated
public class ResumeTrainingExperienceController extends ApiManageController<ResumeTrainingExperienceDTO,ResumeTrainingExperiencePageDTO,ResumeTrainingExperienceExt, ResumeTrainingExperienceSearchExt,ResumeTrainingExperienceDomainVO,ResumeTrainingExperienceDetailDomainVO,ResumeTrainingExperienceDetailVO,ResumeTrainingExperienceListVO,String> {

	@Resource(name = "resumeTrainingExperienceService")
	private IResumeTrainingExperienceService resumeTrainingExperienceService;

	@Resource
	private IResumeEsService resumeEsService;


	@Override
	public void afterPostAdd(ResumeTrainingExperienceDTO dto, ResumeTrainingExperienceExt domain, ResumeTrainingExperienceDetailVO resumeTrainingExperienceDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeTrainingExperienceDetailVO, request, session);
		resumeEsService.publishResumeTrainingExperienceByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostMod(ResumeTrainingExperienceDTO dto, ResumeTrainingExperienceExt domain, SkJsonResult<ResumeTrainingExperienceDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeTrainingExperienceByResumeId(domain.getResumesId());

	}

	@Override
	public IBaseService<ResumeTrainingExperienceExt, ResumeTrainingExperienceSearchExt,String> getBaseService() throws SkException {
		return resumeTrainingExperienceService;
	}

	@Override
	public String getBaseRoute() {
		return "/resumeTrainingExperience/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "培训经历";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeTrainingExperienceDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_training_experience.rte_id) as countNum");
		return totalMapSet;
	}


}